package cn.fengzhilun.javase.day09;

import java.util.Timer;
import java.util.TimerTask;

import org.junit.Test;

public class TestTimer {
	@Test
	public void test1() throws InterruptedException {
		Timer timer =new Timer();
		
		MyTask task =new MyTask();
		
		timer.schedule(task, 2000);
		
		Thread.sleep(3000);
	}
	
	
}

class MyTask extends TimerTask{

	@Override
	public void run() {
		System.out.println("任务已经跑起来了");
	}
	
	
}